﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;

namespace BusinessLogicLayer
{
    public class ShowPhuCap
    {
        PhuCapBLL pcBLL = new PhuCapBLL();
        CT_PhuCapBLL ctpcBLL = new CT_PhuCapBLL();
        public string ShowTTPhuCap(List<NHANVIEN2> nv, int _thang, int _nam)
        {
            string _showpc = "";
            #region nhap
            _showpc += "<table cellspacing='0' cellpadding='5px'>";

            //Lấy tất cả phụ cấp
            List<PHUCAP> pc = pcBLL.LayTatCa();
            //header
            _showpc += "<tr>";
            _showpc += "<td style='color:Green; width:150px; font-weight:bold; border-bottom:1px solid #968DFD;'>Loại Phụ Cấp</td>";
            foreach (var a in pc)
            {
                _showpc += "<td  align='center' style='color:Green; width:40px; font-weight:bold; border-bottom:1px solid #968DFD;'>" + a.TenPhuCap + "</td>";
            }

            _showpc += "<td  align='center' style='color:Green; width:40px; font-weight:bold; border-bottom:1px solid #968DFD;'>";
            _showpc += "Sửa";
            _showpc += "</td>";

            _showpc += "</tr>";

            //Nội Dung Chính
            foreach (var i in nv)
            {
                _showpc += "<tr>";
                _showpc += "<td style='color:Green; width:150px; font-weight:bold; border-bottom:1px solid #968DFD;'>" + i.HoTen + "</td>";
                foreach (var a in pc)
                {
                    if (ctpcBLL.KiemTraPhuCap(_thang, _nam, i.MaNV, a.MaPhuCap) == true)
                    {
                        _showpc += "<td  align='center' style='color:Green; width:40px; font-weight:bold; border-bottom:1px solid #968DFD;'>";
                        _showpc += "<asp:Image ID='Image1' runat='server' ImageUrl='~/Scripts/Image/Check-icon.png'  Width='18px' Height='18px' />";
                        _showpc += "</td>";
                    }
                    else
                    {
                        _showpc += "<td  align='center' style='color:Green; width:40px; font-weight:bold; border-bottom:1px solid #968DFD;'></td>";
                    }
                }
                _showpc += "<td  align='center' style=' width:40px; font-weight:bold; border-bottom:1px solid #968DFD;'>";
                _showpc += "<input type='button' id='btSua" + i.MaNV.ToString() + "' runat='server' value='Sửa' onclick='Xem(" + i.MaNV.ToString() + ");' />";
                //_showpc += "<input type='button' id='btSua" + i.MaNV.ToString() + "' runat='server' value='Sửa' onclick='Xem(" + i.MaNV.ToString() + "," + _thang.ToString() + "," + _nam.ToString() + ");' />";
                
               // _showpc += "<input type='button' id='btSua' runat='server' value='Sửa' onclick='Xem(10,14,19);' />";
                //_showpc += "<asp:Button ID='Button" + i.MaNV.ToString() + "' runat='server' Text='Button' />";
                _showpc += "</td>";

                _showpc += "</tr>";
            }
            #endregion

            return _showpc;
        }
    }
}
